package edu.neu.cs6515.player.strategy;

import java.util.List;

import edu.neu.cs6515.admin.Administrator;
import edu.neu.cs6515.board.BoardCoord;
import edu.neu.cs6515.board.HexagonBoard;
import edu.neu.cs6515.util.Pair;
import edu.neu.cs6515.xml.Placement;
import edu.neu.cs6515.xml.Score;
import edu.neu.cs6515.xml.Tile;

public class MostPointsThenLowerColorsStrategy extends AbstractStrategy {

    LowerColorsMorePointsStrategy lowerStrategy = new LowerColorsMorePointsStrategy();

    MostSumPointsStrategy mostSumStrategy = new MostSumPointsStrategy();

    @Override
    public Placement getNextMove(final List<Tile> tilesInHand,
            final int numberOfPlayers,
            final List<Placement> placementsSofar,
            final Score scoreBeforePlacement) {
        HexagonBoard hexBoard = new HexagonBoard(numberOfPlayers);
        hexBoard.updateHexagonBoard(placementsSofar);

        if (placementsSofar.size() < Administrator.INITIAL_TILES_IN_BAG / 2 &&
                placementsSofar.size() < hexBoard.getHexagons().size() / 5) {
            return mostSumStrategy.getNextMove(tilesInHand,
                    numberOfPlayers, placementsSofar, scoreBeforePlacement);
        } else {
            return lowerStrategy.getNextMove(tilesInHand,
                    numberOfPlayers,
                    placementsSofar,
                    scoreBeforePlacement);
        }
    }
}